<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-type-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">显示顺序：</label>
				<div class="col-sm-8">
					<input id="typeSort" name="typeSort" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">分类名称：</label>
				<div class="col-sm-8">
					<input id="typeName" name="typeName" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">所属餐别：</label>
				<div class="col-sm-8">
					<div  class="radio-box"  th:each="dict : ${@dict.getType('dinner_type')}">
						<input type="checkbox"   th:text="${dict.dictLabel}"  name="belongType"  th:value="${dict.dictValue}"


						/>
					</div>

			</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">排餐菜数：</label>
				<div class="col-sm-8">
					<input id="typeNums" name="typeNums" class="form-control" type="text" placeholder="如素菜，每餐排5个，就填写5">
				</div>
			</div>

			<div class="form-group">	
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">
				    <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
						<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
						<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
					</div>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "dailymenu/dishtype"
		$("#form-type-add").validate({
			rules:{
				typeName:{
        			required:true,
        		},
        		typeSort:{
        			required:true,
        		},
			},
			submitHandler: function(form) {
				$.operate.save(prefix + "/add", $('#form-type-add').serialize());
			}
		});
		
		// h新建进入此页聚焦于第一输入框
		document.getElementsByName("typeSort")[0].focus()
		// h弹框自适应高度
		function isScrollY(addition) {
// 			如果有滚动条
		   	if(!(document.documentElement.scrollHeight > document.documentElement.clientHeight)){
		   		var alertHeight = document.querySelector("form").clientHeight+addition
				window.parent.$('.layui-layer-iframe').height(alertHeight)
				window.parent.$('iframe').height(alertHeight)
				$('html').height(alertHeight)
				$('body').height(alertHeight)
		   	}
		}
		isScrollY(70)
		
	</script>
</body>
</html>
